const eventWrapper = new EventTarget()

const listenerList = {}

eventWrapper.on = (eventName, call, options) => {
    eventWrapper.addEventListener(eventName, call, options)
    listenerList[eventName] = call
}

eventWrapper.emit = (eventName, options) => {
    let event = new Event(eventName)
    options ? event.options = options : null
    eventWrapper.dispatchEvent(event)
}

eventWrapper.remove = (eventName) => {
    eventWrapper.removeEventListener(eventName, listenerList[eventName])
}

export default eventWrapper